{include file="public/header"}
{load href="/public/static/Content/ThemesBusiness/ListPage.css"}
<style>
    .datagrid-view {
        overflow-x: scroll;
    }
</style>
<script src="/public/static/Scripts/common-binder-list-view.js"></script>
<script src="/public/static/Scripts/ScriptsEasyui/datagrid-filter.js"></script>

<script type="text/javascript">

    var data = null;
    var gridListHandler = new listGridHandler(data, 'gridListHandler', 'gridList');
    gridListHandler.formName = '管理员';
    gridListHandler.enableFilter = false;
    $(function () {
        gridListHandler.bindFilter($('#gridList'));
    });

    function ShowNew() {
        var id = undefined;
        window.showBusinessForm("新建菜单", '/admin/user/add.html?id=' + id);
    }


    function EditRecord(id) {
        //alert(id);return;
        if (id <= 0) {
            $.messager.alert('提示', "没有ID", 'info');
            return 0;
        } else {
            window.showBusinessForm("管理员组编辑", '/admin/user/add.html?id=' + id);
        }


    }

    var width = $(window).width() * 1;
    var height = $(window).height() * 1;
    function auth(id) {
        //alert(id);return;
        if (id <= 0) {
            $.messager.alert('提示', "没有ID", 'info');
            return 0;
        } else {
            window.showBusinessForm("管理员权限编辑", '/admin/user/auth.html?id=' + id,width,height);
        }


    }

    function rwp(id) {
        //alert(id);return;
        if (id <= 0) {
            $.messager.alert('提示', "没有ID", 'info');
            return 0;
        } else {
            window.showBusinessForm("修改密码", '/admin/user/pwd.html?id=' + id);
        }


    }


    function del(id) {
        if (id <= 0) {
            $.messager.alert('提示', "删除失败", 'info');
            return 0;
        }

        $.messager.confirm('删除确认', '确实要删除选中的记录？', function (r) {
            if (r) {
                $.ajax({
                    type: "POST",
                    url: '/admin/user/del.html?id=' + id,
                })
                    .success(function (result) {
                        if (result.status > 0) {
                            $.messager.alert('提示', result.msg, "info");
                            window.location.reload();
                        } else {
                            $.messager.alert('提示', result.msg, "error");
                        }
                    })
                    .error(function (result) {
                        var message = "很抱歉，操作出现异常！请联系管理员。";
                        if (result) {
                            if (result.responseJSON && result.responseJSON.ExceptionMessage) {
                                message = result.responseJSON.ExceptionMessage;
                            }
                            else if (result.responseText) {
                                message = result.responseText;
                            }
                        }

                        $.messager.alert('错误', message.replace("-10", ""), 'error');
                    });
            }
        });

    }

    function formatAction(val, row, index) {

        val = '{eq name="power.edit" value="true"}<a href="#" style="float:left" title="编辑" onclick="EditRecord(' + row.id + ')"><div class="icon-page-edit"></div></a>{/eq}' +
            '<a href="#" style="float:left" title="权限" onclick="auth(' + row.id + ')"><div class="icon-page-splb"></div></a>' +
            '{eq name="power.del" value="true"}<a href="#" style="float:left" title="删除" onclick="del(' + row.id + ')"><div class="icon-page-delete"></div></a>{/eq}' +
            '<a href="#" style="float:left" title="修改密码" onclick="rwp(' + row.id + ')"><div class="icon-page-pwd"></div></a>';

        return val;

    }
    function formatState(val, row, index) {
        if (row.status == 1) {
            val = '正常';
        }
        else {
            val = '已停用';
        }
        return val;
    }


</script>



<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false">
        <table id="gridList" exUsageType="SingleSelection"
            data-options="pagination:true,pageSize:15,pageList:[10,15,20],multiSort:true,remoteSort:true,striped:true,fit:true,fitColumns:true,rownumbers:true,idField:'_ID',singleSelect: true"
            url="/admin/user/index.html?ajax=1">
            <thead data-options="frozen:true">
                <tr>
                    <th
                        data-options="field:'id',formatter:formatAction,width:180,halign:'center',align:'center',filterable:false">
                        操作</th>
                    <th data-options="field:'username',halign:'center',align:'left',width:180,filterable:false">管理员名称
                    </th>
                    <th data-options="field:'realname',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">真实姓名</span></th>
                    <th data-options="field:'company_name',halign:'center',align:'left',width:180,filterable:false">
                        <span class="grid-header-sortable">公司名称</span>
                    </th>
                    <th data-options="field:'group',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">所属组</span></th>
                    <th data-options="field:'kf',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">是否客服短信</span></th>
                    <th data-options="field:'wx',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">是否维修短信</span></th>
                    <th data-options="field:'email',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">邮箱</span></th>
                    <th data-options="field:'telephone',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">手机</span></th>
                    <th
                        data-options="field:'status',halign:'center',align:'left',width:180,filterable:false,formatter:formatState">
                        <span class="grid-header-sortable">状态</span>
                    </th>
                    <th data-options="field:'addtime',halign:'center',align:'left',width:180,filterable:false"><span
                            class="grid-header-sortable">添加时间</span></th>
                </tr>
            </thead>
            <!--  <thead>
                <tr>
                   
                </tr>

            </thead> -->
        </table>
    </div>
    <div data-options="region:'north',border:false" class="grid-toolbar-panel" id="gridList_ToolBar">
        {eq name="power.add" value="true"}
        <a href="#" id="new" onclick="ShowNew()" class="easyui-linkbutton grid-toolbar-button"
            data-options="iconCls:'icon-add'" title="新建">新建</a>
        {/eq}
        <!--  <a href="#" id="dels" onclick="gridListHandler.showDeleteDialog()" class="easyui-linkbutton grid-toolbar-button" data-options="iconCls:'icon-remove'" title="删除">删除</a>
        <span style="padding-left:50px;">按条件查询：   <select class="easyui-combobox"  name="state" id="GroupID" data-options="required:true,tipPosition:'right'," style="width:152px;">
                            <option value="0">选择会员组</option>
                          
                        </select>  会员名：<input type="text" id="Name" /> 真实姓名：<input type="text" id="RealName" />  <a href="#" style="padding-left:10px;" onclick="Search()">查询</a></span> -->
    </div>
</div>
<!-- <script type="text/javascript">
    function Search(){
        var str="";
        if($("#GroupID").combo('getValue')!=0){
            str+="GroupID="+$("#GroupID").combo('getValue')+"&";
        }
        if($("#Name").val()!=""){
            str+="Name="+$("#Name").val()+"&";
        }
        if($("#RealName").val()!=""){
            str+="RealName="+$("#RealName").val()+"&";
        }
        if(str!=""){
            if(GetQueryString("UsageType")!=null){
                str+="UsageType="+GetQueryString("UsageType")+"&";
            }
            location.href="/admin/LBUser/index?" +str.substr(0,str.length-1);
         //   window.parent.window.MenuClickHrefEvent("/admin/LBUser/index?" +str.substr(0,str.length-1), "会员管理", "tabsChildContent_1");
        }else{
            if(GetQueryString("UsageType")!=null){
                str+="?UsageType="+GetQueryString("UsageType");
            }
            location.href="/admin/LBUser/index"+str;
          //  window.parent.window.MenuClickHrefEvent("/admin/LBUser/index", "会员管理", "tabsChildContent_1");
        }
    }

</script> -->
{include file="public/footer"/}